/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-13
 * Time: 23:10
 */
public class Main {
    //编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static int countNine(){
        int count = 0;
        for (int i = 1; i < 100; i++) {
            if (i / 10 == 9){
                count++;
            }
            if(i % 10 == 9){
                count++;
            }
        }
        return count;
    }
    public static void main(String[] args) {
        System.out.println(countNine());
    }
    //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
    /*public static double sum(){
        double a = 1.0;
        double sum = 0;
        for (int i = 1; i <= 100 ; i++) {
            sum = sum + a / i;
            a = a * (-1);
        }
        return sum;
    }

    public static void main1(String[] args) {
        System.out.println(sum());
    }*/
}

















